package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("test.txt");
        String line="老师是这世上最帅的人";
        byte[] date=line.getBytes(StandardCharsets.UTF_8);
        fos.write(date);
        System.out.println("写入成功");
        fos.close();
    }
}
